export const queryFormItem = [
  {
    type: 'select',
    key: 'deptId',
    otherAttrs: {
      placeholder: '考核部门'
    },
    options: []
  },
  {
    type: 'input',
    key: 'keyword',
    otherAttrs: {
      placeholder: '考核主题'
    }
  }
]
// 状态: 1=启用 2=停用
const formatStatus = scope => {
  const result = {
    value: '',
    color: ''
  }
  switch (scope.row.status) {
    case 1:
      result.value = '启用'
      break
    case 2:
      result.value = '停用'
      result.color = '#a8a8a8'
      break
    default:
      break
  }
  return result
}
export const tableColumn = (page, size) => {
  return [
    {
      key: 'deptName',
      label: '考核部门',
      minWidth: 100
    },
    {
      key: 'topic',
      label: '考核主题',
      minWidth: 100
    },
    {
      key: 'status',
      label: '状态',
      minWidth: 50,
      render: (h, scope) => (
        <span style={'color:' + formatStatus(scope).color}>
          {formatStatus(scope).value}
        </span>
      )
    },
    {
      key: 'createTime',
      label: '创建时间',
      minWidth: 100
    }
  ]
}

export const updateFormItem = [
  {
    type: 'select',
    key: 'deptId',
    label: '考核部门：',
    col: 24,
    required: true,
    slotAttrs: {
      options: [],
      style: {
        width: '60%'
      },
      size: 'small'
    }
  },
  {
    type: 'input',
    key: 'topic',
    label: '考核主题：',
    col: 24,
    required: true,
    slotAttrs: {
      style: {
        width: '60%'
      },
      size: 'small'
    }
  }
]
